package com.igeek.boot.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author fengqq
 * @Description TODO
 * @Date 2024/9/9  9:40
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("商品类")
@TableName("items")
public class Items implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer id;

    private String name;
    private Float price;
    private String detail;
    private String pic;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai")
    /*默认jackson中不支持jdk8时间类型的序列化 则手动针对LocalDateTime进行序列化
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)*/
    private LocalDateTime createtime;

    //逻辑删除 update  ... set is_delete=1 where is_delete=0
    //查询    select ... where is_delete=0
    @TableLogic
    private Integer isDelete;

}
